<!DOCTYPE html>
<html>
<button onclick="addTimeBox()">添加时间</button>
<div id="container"></div>

<script>
function addTimeBox() {
  const time = new Date().toLocaleString('zh-CN', { 
    hour12: false 
  }).replace(/\//g, '-'); // 生成格式：YYYY-M-D HH:MM:SS
  
  const box = document.createElement('input');
  box.type = 'text';
  box.value = time;
  box.readOnly = true;
  
  document.getElementById('container').appendChild(box);
}
</script>
</body>
</html>